package com.znh.Factory;

import com.znh.entity.*;
import com.znh.enums.PieceInitLocationEnum;
import com.znh.enums.PiecePlayerEnum;

import java.awt.*;

/**
 * @version 1.0
 * @Author znh
 * @Date 2024/5/24 下午3:33
 * @注释 简单工厂-生产棋子
 */
public class PieceFactory {

    /**
     *
     * @param id    棋子id
     * @param name  棋子名称
     * @param point 棋子逻辑坐标
     * @param player 棋子阵营
     * @param initLocation 棋子初始位置
     * @return
     */
    public static Piece createPiece(int id,String name, Point point, PiecePlayerEnum player, PieceInitLocationEnum initLocation) {
        switch (name) {
            case "boss":
                return new Boss(id,point,player,initLocation);
            case "shi":
                return new Shi(id,point,player,initLocation);
            case "xiang":
                return new Xiang(id,point,player,initLocation);
            case "ma":
                return new Ma(id,point,player,initLocation);
            case "che":
                return new Che(id,point,player,initLocation);
            case "pao":
                return new Pao(id,point,player,initLocation);
            case "bing":
                return new Bing(id,point,player,initLocation);
            default:
                return null;
        }
    }
}
